package com.ideal.service.access.impl;

import com.ideal.service.access.IniAccessService;
import com.ideal.service.cache.IniCacheService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @Author songfz
 * @Description ini文件内容业务处理类
 * @Date 2022/8/8
 */
@Service
public class IniAccessServiceImpl implements IniAccessService {

    @Autowired
    private IniCacheService iniCacheService;


    /**
     * ini文件内容缓存添加
     * @param fileEnName
     * @param context
     * @return
     */
    @Override
    public boolean addIniDataCache(String fileEnName, Map<String, Map<String, String>> context){

        for (Map.Entry<String, Map<String, String>> entry : context.entrySet()) {

            iniCacheService.addIniCache(fileEnName,entry.getKey(),entry.getValue());
        }
        return true;
    }


    @Override
    public Map getIniSectionContents(String fileEnName, String section){
        return iniCacheService.getSectionContents(fileEnName,section);
    }

    @Override
    public boolean fuzzyDelKeyAll(String key){
        return iniCacheService.fuzzyDelKeyAll(key);
    }
}
